FROM centos:centos7@sha256:8faead07bd1d5fdd17414a1759eae004da5daa9575a846f4730f44dec0f47843
MAINTAINER biebbwa@163.com
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    cd /etc/pki/rpm-gpg && \
    curl -O http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 && \
    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \
    rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm && \
    rpm --rebuilddb && yum install -y vim  net-tools unzip java-1.6.0-openjdk*


ADD server.tar.gz .
ADD lib.tar.gz /usr/local/
COPY docker-entrypoint.sh /usr/local/bin
COPY wait-for-it.sh /usr/local/bin

RUN  chmod +x /usr/local/bin/docker-entrypoint.sh && \
     chmod +x /usr/local/bin/wait-for-it.sh && \
     rm -rf /etc/ssl && \
     ln -s /server/etc/ssl /etc/ssl  && \
     ln -s /server/gamed/libskill.so /lib/libskill.so  && \
     ln -s /server/gamed/libtask.so /lib/libtask.so  && \
     ln -s /server/etc/authd.conf /etc/authd.conf  && \
     ln -s /server/etc/gmopgen.xml /etc/gmopgen.xml  && \
     ln -s /server/etc/GMserver.conf /etc/GMserver.conf  && \
     ln -s /server/etc/hosts.pw /etc/hosts.pw  && \
     ln -s /server/etc/iweb.conf /etc/iweb.conf  && \
     ln -s /server/etc/pkcs11.cfg /etc/pkcs11.cfg  && \
     ln -s /server/etc/table.xml /etc/table.xml && \
     ln -s /server/etc/ssl/keystore.jks /root/keystore.jks && \
     echo '/usr/local/lib' >> /etc/ld.so.conf && \
     ldconfig -v

WORKDIR /server

ENTRYPOINT wait-for-it.sh  mysql:3306 -s -t 0 -- docker-entrypoint.sh